<?php
namespace Controller;
use Kuyuan\WqCore\controller\Controller;
use Model\SystemModel;

/**
 * 基础设置
 * Class Media
 * @package Controller
 */
class System extends Controller
{

    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 获取全局配置
     */
    public function find()
    {
        $_system = SystemModel::cache(!KUYUAN_DEBUG)
                                ->find();
        if(!$_system){
            SystemModel::create(
                array(
                    "kuyuan_defend" => "0",
                    "notice" => ""
                )
            );
            return $this->find();
        }
        return $_system;
    }

    /**
     * 设置全局配置
     * @param array $_data 修改的数据
     * @return mixed
     */
    public function set($_data)
    {
        return SystemModel::update($_data);
    }

}